import React from "react"
import { createStore, applyMiddleware } from 'redux';
import { Provider } from "react-redux";
import { Card } from 'antd';
import redux from "./reactx05/reduxs"
//redux-logger 打印中间件

import ReactX0501 from "./reactx05/reactx05-01"
const logger = store => next => action => { 
   //中间件 可以进行处理数据
    console.log("dispatch", action)
    let result = next(action);
    console.log("next-store", store.getState())
    return result
}
const store = createStore(redux, applyMiddleware(logger)) 
// const store = createStore(redux,0 ,applyMiddleware(logger)) 
//第二个参数 就是state 可以从ajax发过来
class ReactX05 extends React.Component {
    constructor(props) {
        super(props);
    console.log(this)
    }
    render() {
        return (
            <Provider store={store}>
                <Card title="redux中间件--applyMiddleware" bordered={false}>
                    <ReactX0501 />
                </Card>
            </Provider>
        )
    }
}
export default ReactX05